<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: lz
 * @LastEditTime: 2022-01-08 16:34:23
-->
<template>
  <!--1. 容器 -->
  <div ref="bottom2_container" style="height: 95%"></div>
</template>
<script>
import { Line } from '@antv/g2plot';
import {get} from '../../../utils/request';
import moment from 'moment';
export default {
  data(){
   return{
     dataArr: []
   }
  },
  mounted(){
  this.initData()
  },
  methods:{
    initData(){
       get('/dashboard/queryMouthData',{
       
      }).then(res=>{
        this.dataArr=res.data;
        console.log(7777,res)
        this.initChart();
      })
    },
    initChart(){
         const line = new Line(this.$refs.bottom2_container, {
          data:this.dataArr,
          xField: 'date',
          yField: 'value',
          seriesField: 'type',
          xAxis: {
              type: 'time',
                  },
          yAxis: {
             label: {
            // 数值格式化为千分位
          formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`),
                    },
               },
            });

         line.render();
    }
  }
}
</script>
<style scoped>

</style>